home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / barcodes.zip / SAMPLE1.ZIP / BARTEST.CPP < prev    next >
C/C++ Source or Header  |  1994-11-07  |  4KB  |  168 lines

  1. // bartest.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. // (c) Copyright 1994 HEX TECHNOLOGY. All rights reserved.
  5. // This sample code is provided as a example implementation
  6. // using barcodes.dll.  You may only distribute or modify this
  7. // code if you purchase a license for barcodes.dll.
  8.  
  9. #include "stdafx.h"
  10. #include "bartest.h"
  11.  
  12. #include "mainfrm.h"
  13. #include "bardoc.h"
  14. #include "barvw.h"
  15. #include  "ctl3d.h"
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CBarApp
  24.  
  25. BEGIN_MESSAGE_MAP(CBarApp, CWinApp)
  26.     //{{AFX_MSG_MAP(CBarApp)
  27.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  28.         // NOTE - the ClassWizard will add and remove mapping macros here.
  29.         //    DO NOT EDIT what you see in these blocks of generated code!
  30.     //}}AFX_MSG_MAP
  31.     // Standard file based document commands
  32.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  33.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  34.     // Standard print setup command
  35.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CBarApp construction
  40.  
  41. CBarApp::CBarApp()
  42. {
  43.     // TODO: add construction code here,
  44.     // Place all significant initialization in InitInstance
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CBarApp object
  49.  
  50. CBarApp NEAR theApp;
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CBarApp initialization
  54.  
  55. BOOL CBarApp::InitInstance()
  56. {
  57.     // Standard initialization
  58.     // If you are not using these features and wish to reduce the size
  59.     //  of your final executable, you should remove from the following
  60.     //  the specific initialization routines you do not need.
  61.     Ctl3dRegister( AfxGetInstanceHandle());
  62.     Ctl3dAutoSubclass( AfxGetInstanceHandle()); 
  63.  
  64.     SetDialogBkColor();        // Set dialog background color to gray
  65.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  66.  
  67.     // Register the application's document templates.  Document templates
  68.     //  serve as the connection between documents, frame windows and views.
  69.  
  70.     CMultiDocTemplate* pDocTemplate;
  71.     pDocTemplate = new CMultiDocTemplate(
  72.         IDR_BARCTYPE,
  73.         RUNTIME_CLASS(CBarDoc),
  74.         RUNTIME_CLASS(CBarFrame),       
  75.         RUNTIME_CLASS(CBarView));
  76.     AddDocTemplate(pDocTemplate);
  77.  
  78.     // create main MDI Frame window
  79.     CMainFrame* pMainFrame = new CMainFrame;
  80.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  81.         return FALSE;
  82.     m_pMainWnd = pMainFrame;
  83.  
  84.     // enable file manager drag/drop and DDE Execute open
  85.     EnableShellOpen();
  86.     RegisterShellFileTypes();
  87.  
  88.     // simple command line parsing
  89.     if (m_lpCmdLine[0] == '\0')
  90.     {
  91.         // create a new (empty) document
  92.         OnFileNew();
  93.     }
  94.     else
  95.     {
  96.         // open an existing document
  97.         OpenDocumentFile(m_lpCmdLine);
  98.     }
  99.  
  100.     m_pMainWnd->DragAcceptFiles();
  101.     // The main window has been initialized, so show and update it.
  102.     pMainFrame->ShowWindow(m_nCmdShow);
  103.     pMainFrame->UpdateWindow();
  104.     
  105.     OnAppAbout();
  106.     
  107.     return TRUE;
  108. }  
  109.  
  110. int CBarApp::ExitInstance() {   
  111.   
  112.     
  113.     Ctl3dUnregister(AfxGetInstanceHandle());   
  114.   
  115.     return CWinApp::ExitInstance();
  116. };   
  117.  
  118. /////////////////////////////////////////////////////////////////////////////
  119. // CAboutDlg dialog used for App About
  120.  
  121. class CAboutDlg : public CDialog
  122. {
  123. public:
  124.     CAboutDlg();
  125.  
  126. // Dialog Data
  127.     //{{AFX_DATA(CAboutDlg)
  128.     enum { IDD = IDD_ABOUTBOX };
  129.     //}}AFX_DATA
  130.  
  131. // Implementation
  132. protected:
  133.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  134.     //{{AFX_MSG(CAboutDlg)
  135.         // No message handlers
  136.     //}}AFX_MSG
  137.     DECLARE_MESSAGE_MAP()
  138. };
  139.  
  140. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  141. {
  142.     //{{AFX_DATA_INIT(CAboutDlg)
  143.     //}}AFX_DATA_INIT
  144. }
  145.  
  146. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  147. {
  148.     CDialog::DoDataExchange(pDX);
  149.     //{{AFX_DATA_MAP(CAboutDlg)
  150.     //}}AFX_DATA_MAP
  151. }
  152.  
  153. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  154.     //{{AFX_MSG_MAP(CAboutDlg)
  155.         // No message handlers
  156.     //}}AFX_MSG_MAP
  157. END_MESSAGE_MAP()
  158.  
  159. // App command to run the dialog
  160. void CBarApp::OnAppAbout()
  161. {
  162.     CAboutDlg aboutDlg;
  163.     aboutDlg.DoModal();
  164. }
  165.  
  166. /////////////////////////////////////////////////////////////////////////////
  167. // CBarApp commands
  168.